$(function() {
    var userloginurl = '/user/douserlogin';
	$('#j_captcha').keyup(function (event) {
        if(event.keyCode ==13){
            $("#submit").click();
		}
    })
	//提交
	$('#submit').click(function() {
		var bloguser = {};

		bloguser.username = $('#username').val();
		bloguser.password = $('#password').val();
		var formData = new FormData();
        var verifyCodeActual = $('#j_captcha').val();
        if (!verifyCodeActual) {
            $('.input_captcha').click();
            return;
        }
        formData.append("verifyCodeActual", verifyCodeActual);
		formData.append('BlogUserStr', JSON.stringify(bloguser));
		$.ajax({
			// url : (isEdit? editShopUrl:addShopUrl),
			url : userloginurl,
			type : 'POST',
			// contentType: "application/x-www-form-urlencoded; charset=utf-8",
			data : formData,
			contentType : false,
			processData : false,
			cache : false,
			success : function(data) {
				if (data.success) {
					$('.success').click();
                    window.setTimeout("window.location='/community/index'",1500);
				} else {
					$('.fail-message').html(data.errMsg);
                    $('.fail').click();
				}
			}
		});
	});

});